<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
</head>
<body>
<div>
  <h3>修改密码</h3>
  <span>请输入原密码：</span><input type="text" id="oldPassword"><br>
  <span>请输入新密码：</span><input type="text" id="newPassword1"><br>
  <span>请确认新密码：</span><input type="text" id="newPassword2"><br>
  <button id="btn">修改密码</button>
</div>
<script src="/js/jquery-3.6.0.js"></script>
<script>

    $("#btn").click(function () {
      var oldPassword=$("#oldPassword").val();
      var newPassword1=$("#newPassword1").val();
      var newPassword2=$("#newPassword2").val();


      $.ajax({
        url:"/admin/updPassword",
        type:"post",
        data:"oldPassword="+oldPassword+"&newPassword1="+newPassword1+"&newPassword2="+newPassword2,
        success:function (R){
          if (R.code==300){
                alert(R.data);
                return;
          }
            if (R.code==200){
                alert(R.data);
                window.top.location.href="/html/login.html"
                return;
            }
        }
      })
    })
</script>
</body>
</html>